// 保存缓存
export const setStorage = (key, value, type = "session") => {
    if (type === "session"&&value!=undefined) {
      setSession( key, value);
    } else {
      // setLocal(key, value);
    }
  };
  
  export const removeStorage = (key1,key2) => {
    localStorage.removeItem(key1,key2);
  };
  
  export const setSession = (key, value) => {
    if(value!=undefined){
      localStorage.removeItem(key);
      localStorage.setItem(key, JSON.stringify(value));
    }
  };
  
  // 获取缓存
  export const getStorage = (key, type = "session") =>
  type === "session" ? getSession( key) : getLocal(key);
  
  export const getSession = key => {
  const value = localStorage.getItem(key);
  return value ? JSON.parse(value) : "";
  };